package main

import (
	"EsTag/esController"
	//	"EsTag/mysqlUtility"
	"EsTag/antmongo"
	"EsTag/utility"
	"fmt"
	//	"strings"

	//	"github.com/astaxie/beego"
)

func main() {
	antmongo.MgoLoadConfig()

	// 打印ip地址
	ip, err := utility.GetLocalIp()
	if err == nil {
		fmt.Println("调用" + ip)

	}
	//删除索引
	esController.DeleteTagIndex("estag")
	//导入数据
	esController.CreateTagIndexAndStartTransport("estag")
	//	// 获取学校列表
	//	var schoolTotal string = beego.AppConfig.String("todo-school::name")
	//	var schoolList = strings.Split(schoolTotal, ".")
	//	fmt.Println(schoolList)

	//	// 遍历，删除并创建索引，插入数据
	//	for _, school := range schoolList {
	//		fmt.Println(school)
	//		var dbConfig = mysqlUtility.DbConfig{
	//			IP:        beego.AppConfig.String("mysql-" + school + "::host"),
	//			Port:      beego.AppConfig.DefaultInt64("mysql-"+school+"::port", 3306),
	//			User:      beego.AppConfig.String("mysql-" + school + "::user"),
	//			Pwd:       beego.AppConfig.String("mysql-" + school + "::pwd"),
	//			Database:  beego.AppConfig.String("mysql-" + school + "::database"),
	//			IdleConns: beego.AppConfig.DefaultInt("mysql-"+school+"::idleconns", 100),
	//		}

	//		// 数据库初始化
	//		mysqlUtility.DB_CONF = dbConfig
	//		mysqlUtility.StartInit()
	//		esController.DeleteTagIndex(school + "tag")
	//		esController.CreateTagIndexAndStartTransport(school + "tag")

	//		mysqlUtility.CloseConn()
	//	}
}
